{include file="public/header" /}

<style>
    body{
        background: #FFF;
    }
    .content img {
        transition-duration:0.5s;
    }
    .content img:hover {
        transform: scale(3);
    }
    .content .imageframe {
        width: 180px;
        height: 100px;
        overflow: hidden;


    }

</style>

<div class="page">
    <a href="javascript:history.go(-1)" class="btn" title="返回上一步">返回上一步</a>
    <table class="ds-default-table order">
        <tbody>
        <tr>
            <th>{$Think.lang.order_info}</th>
        </tr>
        <tr>
            <td colspan="2">
                <ul>
                    <li><strong>{$Think.lang.ds_order_sn}:</strong>{$order_info.order_sn}</li>
                    <li><strong>{$Think.lang.order_state}:</strong>{$order_state[$order_info.order_state]}</li>

                    <?php
                         if($order_info['order_state'] == 6){
                    ?>
                            <li><strong>审核失败原因:</strong>{$order_info.examine_failed_reason}</li>
                    <?php
                        }
                    ?>
                    <li><strong>订单来源:</strong>{$order_source[$order_info.order_source]}</li>
                    <li><strong>订单类型:</strong>{$order_type[$order_info.order_type]}</li>
                    <li><strong>订单预约时间:</strong>{$order_info.appointment_time}</li>
                    <li><strong>订单创建时间:</strong>{$order_info.add_time|date="Y-m-d H:i:s",###}</li>
                    <li><strong>订单备注:</strong>{$order_info.remarks}</li>
                    
                    <?php
                         if($order_info['order_state'] != 6 && $order_info['order_state'] != -1){
                    ?>
                    <li><strong>管理员备注:</strong>{$order_info.manager_remark}</li>
                    <li><strong>服务内容:</strong>{$order_info.service_content}</li>
                    <?php
                        }
                    ?>
                    <?php
                         if($order_info['order_state'] == -1){
                    ?>
                    <li><strong>取消原因:</strong>{$order_info.cantion_reason}</li>
                    <li><strong>取消说明:</strong>{$order_info.cancel_remark}</li>
                    <?php
                        }
                    ?>
                </ul>
            </td>
        </tr>

        <?php
            if($order_info['parent_id'] == 0){
        ?>
        <tr>
            <th>订单价格信息</th>
        </tr>
        <tr>
            <td colspan="2">
                <ul>
                    <li><strong>总订单费用:</strong>{$order_info.order_amount}</li>
                    <li><strong>上门费用:</strong>{$order_info.door_fee}</li>
                    <li><strong>工时合计:</strong>{$order_info.work_master_hous}</li>
                    <li><strong>收取客户工时费用合计:</strong>{$order_info.work_master_price}</li>
                    <li><strong>服务人员总费用:</strong>{$order_info.assign_mechanic_total}</li>
                    <li><strong>配件总费用:</strong>{$order_info.count_part_price}</li>
                    <li><strong>补贴总费用:</strong>{$order_info.subsidy_price}</li>
                </ul>
            </td>
        </tr>
        <?php
            }
        ?>


        <tr>
            <th>买家信息</th>
        </tr>
        <tr>
            <td colspan="2">
                <ul>
                    <li><strong>买家账号:</strong>{$order_info.member_name}</li>
                    <li><strong>运营商:</strong>{$order_info.invite_store_name}</li>
                </ul>
            </td>
        </tr>

        {notempty name="order_info.address"}
        <tr>
            <th>客户信息</th>
        </tr>
        <tr>
            <td>
                <ul>
                    <li><strong>客户姓名{$Think.lang.ds_colon}</strong>{$order_info.address.address_realname}</li>
                   <li><strong>客户电话:</strong>{$order_info.appoint_phone}</li>
                    <li><strong>客户地址{$Think.lang.ds_colon}</strong>{$order_info.appoint_address}&nbsp;{$order_info.appoint_detail_address}&nbsp;</li>
                </ul>
            </td>
        </tr>
        {/notempty}

        <tr>
            <th>服务设备列表
                <?php if($order_info['is_generate'] == 1){?>
                <a style="margin-left: 15px;height: 35px;line-height: 35px;width: 91px;padding: 0 10px;" href="javascript:void(0);" onclick="edit_band_goods({$app_order_mall_id});" class="btn">查看商品订单
                </a>
                 <?php } ?>
            </th>
            </th>
        </tr>

        <tr>
            <td><table class="ds-default-table goods ">
                <tbody>
                <tr>
                    <th class="align-center">设备编号</th>
                    <th class="align-center">设备名称</th>
                    <th class="align-center">品牌</th>
                    <th class="align-center">操作</th>
                </tr>
                {foreach name="$order_info.goods_items" item="goods"}
                <tr>
                    <td class="w20 align-center"><p>{$goods.goods_id}</p></td>
                    <td class="w20 align-center"><p>{$goods.goods_name}</p></td>
                    <td class="w20 align-center"><span class="red_common">{$goods.b_name}</span></td>
                    <td class="w96 align-center">
                        <a href="javascript:dsLayerOpen('{:url('Service/show_detail',['id'=>$goods.id])}','{$Think.lang.ds_view} 子订单详情')" class="dsui-btn-view"><i class="iconfont"></i>{$Think.lang.ds_view}</a>
                        {if $order_info.order_state == 4}
                        <a href="javascript:void(0);"  onclick="edit_time({$goods.id});" class="dsui-btn-view"><i class="iconfont"></i>保养时间</a>
                        {/if}
                    </td>

                </tr>
                {/foreach}
                </tbody>
            </table>
            </td>
        </tr>

       {notempty name="order_info.append_goods_items"}
        <tr>
            <th>追加服务设备列表</th>
        </tr>
        <tr>
            <td><table class="ds-default-table goods ">
                <tbody>
                <tr>
                    <th class="align-center">设备编号</th>
                    <th class="align-center">设备名称</th>
                    <th class="align-center">品牌</th>
                    <th class="align-center">提交人</th>
                    <th class="align-center">状态</th>
                    <th class="align-center">操作</th>
                </tr>
                
                {foreach name="$order_info.append_goods_items" item="goods"}
                <tr>
                    <td class="w20 align-center"><p>{$goods.goods_id}</p></td>
                    <td class="w20 align-center"><p>{$goods.goods_name}</p></td>
                    <td class="w20 align-center"><span class="red_common">{$goods.b_name}</span></td>
                    <td class="w20 align-center"><p>
                        {if $goods.is_backstage eq '0'}
                        后台添加
                        {else /}
                        前台添加
                        {/if}
                    </p></td>
                    <td class="w20 align-center"><p>{$son_order_state[$goods.order_state]}</p></td>
                    <td class="w96 align-center">
                        <a href="javascript:dsLayerOpen('{:url('Service/append_show_detail',['id'=>$goods.id])}','{$Think.lang.ds_view} 子订单详情')" class="dsui-btn-view"><i class="iconfont"></i>{$Think.lang.ds_view}</a>
                        {if $order_info.order_state == 4}
                        <a href="javascript:void(0);"  onclick="edit_time({$goods.id});" class="dsui-btn-view"><i class="iconfont"></i>保养时间</a>
                        {/if}
                    </td>

                </tr>
                {/foreach}
               
                </tbody>
            </table>
            </td>
        </tr>
        {/notempty}

        {notempty name="order_log"}
        <tr>
            <th>{$Think.lang.order_handle_history}</th>
        </tr>
        {foreach name="order_log" item="val"}
        <tr>
            <td>
                {$val.log_role} {$val.log_user}&emsp;{$Think.lang.order_show_at}&emsp;{$val.log_time|date="Y-m-d H:i:s",###}&emsp;{$val.log_msg}
            </td>
        </tr>
        {/foreach}
        {/notempty}
                <tfoot>
                </tfoot>
            </table>
        </tbody>
    </table>

    {notempty name="appends"}
    <table class="ds-default-table order">
        <tr>
            <th>追加服务费列表</th>
        </tr>
        <tr>
            <td><table class="ds-default-table goods ">
                <tr>
                    <th class="align-center">追加id</th>
                    <th class="align-center">追加时长</th>
                    <th class="align-center">追加单位时间收费</th>
                    <th class="align-center">合计</th>
                    <th class="align-center">状态</th>
                    <th class="align-center">服务人员</th>
                    <th class="align-center">申请日期</th>
                    <!-- <th class="align-center">操作</th> -->
                </tr>
                {foreach name="appends" item="append"}
                <tr>
                    <td class="w5 align-center"><p>{$append.id}</p></td>
                    <td class="w20 align-center"><p>{$append.add_hours}</p></td>
                    <td class="w20 align-center"><p>{$append.payper_hour}</p></td>
                    
                    <td class="w20 align-center"><p>{$append.hours_total}</p></td>

                    <td class="w20 align-center"><span class="red_common">{$appendStatus[$append.status]}</span></td>
                    <td class="w20 align-center"><span class="red_common">{$append.originator_name}</span></td>
                    <td class="w180 align-center"><span class="red_common">{$append.created_at|date="Y-m-d H:i:s",###}</span></td>
                    <!-- <td class="w96 align-center">
                        <a href="javascript:void(0);"  onclick="edit_time({$app_order_mall_id});" class="dsui-btn-view"><i class="iconfont"></i>保养时间</a>
                        </td> -->
                </tr>
                {/foreach}
            </table>
            </td>
        </tr>
    </table>
    {/notempty}

    {notempty name="order_info.goods_parts"}
    <table class="ds-default-table order">
        <tr>
            <th>配件列表</th>
        </tr>
        <tr>
            <td><table class="ds-default-table goods ">
                <tr>
                    <th class="align-center">配件编号</th>
                    <th class="align-center">配件名称+规格名</th>
                    <th class="align-center">品牌</th>
                    <th class="align-center">指导价格</th>
                    <th class="align-center">应付金额</th>
                    <th class="align-center">配件价格</th>
                    <th class="align-center">配件数量</th>
                    <th class="align-center">应付总额</th>
                    <th class="align-center">是否携带</th>
                    <th class="align-center">创建时间</th>
                </tr>
                {foreach name="order_info.goods_parts" item="append"}
                <tr>
                    <td class="w5 align-center"><p>{$append.id}</p></td>
                    <td class="w20 align-center"><p>{$append.part_name}</p></td>
                    <td class="w20 align-center"><p>{$append.brand_name}</p></td>
                    <td class="w20 align-center"><p>{$append.goods_price}</p></td>
                    <td class="w20 align-center"><p>{$append.sale_part_price}</p></td>
                    <td class="w20 align-center"><p>{$append.part_price}</p></td>
                    <td class="w20 align-center"><p>{$append.num}</p></td>
                    <td class="w20 align-center"><p><?php echo number_format($append['sale_part_price'] * $append['num'],2);?></p></td>
                    <td class="w20 align-center"><p>
                    {if condition="($append.type==0)"}不需要
                    {elseif condition="($append.type==1)"}需要
                    {/if}
                    </p></td>
                    <td class="w20 align-center"><p>{$append.create_at|date="Y-m-d H:i:s",###}</p></td>
                </tr>
                {/foreach}
            </table>
            </td>
        </tr>
    </table>
    {/notempty}

    {notempty name="order_info.append_goods_parts"}
    <table class="ds-default-table order">
        <tr>
            <th>追加配件列表</th>
        </tr>
        <tr>
            <td><table class="ds-default-table goods ">
                <tr>
                    <th class="align-center">配件编号</th>
                    <th class="align-center">配件名称+规格名</th>
                    <th class="align-center">品牌</th>
                    <th class="align-center">指导价格</th>
                    <th class="align-center">应付金额</th>
                    <th class="align-center">配件价格</th>
                    <th class="align-center">配件数量</th>
                    <th class="align-center">应付总额</th>
                    <th class="align-center">是否携带</th>
                    <th class="align-center">创建时间</th>
                </tr>
                {foreach name="order_info.append_goods_parts" item="append"}
                <tr>
                    <td class="w5 align-center"><p>{$append.id}</p></td>
                    <td class="w20 align-center"><p>{$append.part_name}</p></td>
                    <td class="w20 align-center"><p>{$append.brand_name}</p></td>
                    <td class="w20 align-center"><p>{$append.goods_price}</p></td>
                    <td class="w20 align-center"><p>{$append.sale_part_price}</p></td>
                    <td class="w20 align-center"><p>{$append.part_price}</p></td>
                    <td class="w20 align-center"><p>{$append.num}</p></td>
                    <td class="w20 align-center"><p><?php echo number_format($append['sale_part_price'] * $append['num'],2);?></p></td>
                    <td class="w20 align-center"><p>
                    {if condition="($append.type==0)"}不需要
                    {elseif condition="($append.type==1)"}需要
                    {/if}
                    </p></td>
                    <td class="w20 align-center"><p>{$append.create_at|date="Y-m-d H:i:s",###}</p></td>
                </tr>
                {/foreach}
            </table>
            </td>
        </tr>
    </table>
    {/notempty}

    {notempty name="order_mechanics"}
    <table class="ds-default-table order">
        <tr>
            <th>派单列表</th>
        </tr>
        <tr>
            <td><table class="ds-default-table goods ">
                <tr>
                    <th class="align-center">派单id</th>
                    <th class="align-center">技术工姓名</th>
                    <th class="align-center">技工手机号 </th>
                    <th class="align-center">派单状态</th>
                    <th class="align-center">服务金额</th>
                    <th class="align-center">补贴金额</th>
                    <th class="align-center">创建日期</th>
                    <th class="align-center">操作</th>
                </tr>
                {foreach name="$order_mechanics" item="order_mechanic"}
                <tr>
                    <td class="w5 align-center"><p>{$order_mechanic.id}</p></td>
                    <td class="w20 align-center"><p>{$order_mechanic.name}</p></td>
                    <td class="w20 align-center"><p>{$order_mechanic.phone}</p></td>
                    <td class="w20 align-center"><span class="red_common">{$status[$order_mechanic.status]}</span></td>
                    <td class="w20 align-center"><p>{$order_mechanic.service_money}</p></td>
                    <td class="w20 align-center"><p>{$order_mechanic.money}</p></td>
                    <td class="w180 align-center"><span class="red_common">{$order_mechanic.create_at|date="Y-m-d H:i:s",###}</span></td>
                    <?php
                    if($order_mechanic['status'] == 2){
                    ?>
                    <td class="w96 align-center">
                        <a href="javascript:dsLayerOpen('{:url('Service/show_refuse_detail',['id'=>$order_mechanic.id])}','{$Think.lang.ds_view} 拒单详情')" class="dsui-btn-view"><i class="iconfont"></i>{$Think.lang.ds_view}</a>
                    </td>
                    <?php
                    }
                    ?>
                </tr>
                {/foreach}
            </table>
            </td>
        </tr>
    </table>
    {/notempty}
    <?php if($order_info['order_state'] ==4){?>
    <table border="0" cellpadding="0" cellspacing="0" class="store-joinin ds-default-table">
        <thead>
        <tr>
            <th colspan="20">文件信息：</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <th class="w150">现场图片：</th>
            <td >

                <div class="content">
                    {notempty name="imgs_array"}
                    {foreach name="imgs_array" item="val"}
                    <span class="thumb size-56x56 imageframe">
                         <img style="width: 200px;height: 200px;margin-left: 20px;"  src="{$http_name}/{$val}" onload="javascript:ResizeImage(this,56,56);"/>
                  </span>
                    {/foreach}
                    {/notempty}
                </div>

            </td>
        </tr>
        <tr>
            <th class="w150">签名照：</th>
            <td >

                <div class="content">
                    {notempty name="order_info.service_autograph"}
                    <span class="thumb size-56x56 imageframe">
                         <img style="width: 200px;height: 200px;margin-left: 20px;"  src="{$http_name}/{$order_info.service_autograph}" onload="javascript:ResizeImage(this,56,56);"/>
                  </span>
                    {/notempty}
                </div>

            </td>
        </tr>
        </tbody>
    </table>
    <?php } ?>
</div>
<script>

    function edit_band_goods(ids_str,ids_str2) {
        _uri = ADMINSITEURL+"/order/order_list?order_id=" + ids_str;
        dsLayerOpen(_uri,'查看','900px','500px');
    }

    //设置保养时间
    function edit_time(order_id) {
        _uri = ADMINSITEURL+"/service/edit_time?order_id=" + order_id;
        dsLayerOpen(_uri,'查看','900px','500px');
    }

    
    /**
     * Layer 通用ifram弹出窗口
     */
    function dsLayerOpen(url, title,width,height) {
        if (!width) width = '900px';
        if (!height) height = '500px';
        layer.open({
            type: 2,
            title: title,
            area: [width,height],
            fixed: false, //不固定
            maxmin: true,
            content: url
        });
    }
</script>